2 Problem: 154 - Recycling
3 Andrés Mejía-Posada (andmej@gmail.com)
26 #define D(x) cout << #x " is " << x << endl
31 int diff(string a
, string b
){
32 map
<char, char> ma
, mb
;
33 for (int i
=0; i
<20; i
+= 4){
37 const string letters
= "bogry";
39 for (int i
=0; i
<letters
.size(); ++i
){
40 ans
+= (ma
[letters
[i
]] != mb
[letters
[i
]]);
47 while (getline(cin
, s
) && s
!= "#"){
50 while (getline(cin
, s
) && s
[0] != 'e'){
55 for (int i
=0; i
<n
; ++i
){
57 for (int j
=0; j
<n
; ++j
){
58 score
[i
] += diff(lines
[i
], lines
[j
]);
61 printf("%d\n", min_element(score
.begin(), score
.end()) - score
.begin() + 1);